using Microsoft.UI.Xaml.Controls;
using System;

namespace GoChat_for_Windows.Services
{
    public class NavigationService : INavigationService
    {
        private Frame _frame;

        public void Initialize(Frame frame)
        {
            _frame = frame;
        }

        public bool Navigate(Type pageType)
        {
            if (_frame.Content?.GetType() != pageType)
            {
                return _frame.Navigate(pageType);
            }
            return false;
        }

        public bool Navigate(Type pageType, object parameter)
        {
            if (_frame.Content?.GetType() != pageType)
            {
                return _frame.Navigate(pageType, parameter);
            }
            return false;
        }

        public bool GoBack()
        {
            if (CanGoBack)
            {
                _frame.GoBack();
                return true;
            }
            return false;
        }

        public bool CanGoBack => _frame.CanGoBack;
    }
} 